var axios = require('axios')
var config = require('./dao-config.js')
console.log('NODE_ENV' + NODE_ENV)

let api = config[NODE_ENV].url + config[NODE_ENV].port

module.exports = function (url) {
  var promise = new Promise((resolve, reject) => {
    axios.get(api + url).then((response) => {
      resolve(response)
    }).catch((error) => {
      reject('网络异常')
    })
  })
  return promise
}
